package org.zoomdev.zoom.dao.builder.impl;

import org.zoomdev.zoom.dao.structs.ColumnMeta;

public class ColumnBuildInfo {

    public static final int MEDIUM = 1;
    static final int BIG = 2;
    public int n;
    public int m;
    int type;


    boolean nullable;
    int maxLength;
    Object defaultValue;
    int subType;
    boolean auto;
    boolean unsigned;
    String comment;
    private ColumnMeta.KeyType keyType;
    private String name;

    public boolean isPrimary() {
        return keyType == ColumnMeta.KeyType.PRIMARY;
    }

    public Object getDefaultValue() {
        return defaultValue;
    }

    public void setDefaultValue(Object defaultValue) {
        this.defaultValue = defaultValue;
    }

    public int getSubType() {
        return subType;
    }

    public void setSubType(int subType) {
        this.subType = subType;
    }

    public boolean isAuto() {
        return auto;
    }

    public void setAuto(boolean auto) {
        this.auto = auto;
    }

    public ColumnMeta.KeyType getKeyType() {
        return keyType;
    }

    public void setKeyType(ColumnMeta.KeyType keyType) {
        this.keyType = keyType;
    }

    public boolean isUnsigned() {
        return unsigned;
    }

    public void setUnsigned(boolean unsigned) {
        this.unsigned = unsigned;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public void setDecimal(int n, int m) {
        this.n = n;
        this.m = m;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public boolean isNullable() {
        return nullable;
    }

    public void setNullable(boolean nullable) {
        this.nullable = nullable;
    }

    public int getMaxLength() {
        return maxLength;
    }

    public void setMaxLength(int maxLength) {
        this.maxLength = maxLength;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public boolean isIndex() {
        return keyType == ColumnMeta.KeyType.INDEX;
    }

    public boolean isUnique() {
        return keyType == ColumnMeta.KeyType.UNIQUE;
    }
}
